package com.wangjiacai.hqlQuery.role.converter;



import com.wangjiacai.hqlQuery.role.entity.Role;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/*
 * @auther: wangjiacai
 *
 * @create: 2018-04-26 14:00:35
 */
public class RoleConverter {

    public static Map converterToMap(Role role){
        Map<String,Object> map=new HashMap<>();
        map.put("id",role.getId());
        map.put("text",role.getName());
        map.put("icon","fa fa-user");
        map.put("parent","#");
        return map;
    }

    public static List<Map> converterToMapList(List<Role> roles){
        List<Map> list=new ArrayList<>();
        for(Role role:roles){
            list.add(converterToMap(role));
        }
        return list;
    }

}
